feat: adds support for OpenAPI 3.2.0#65415
Conversation
...enApiDocumentIntegrationTests.VerifyOpenApiDocument_documentName=schemas-by-ref.verified.txt
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
This pull request adds support for OpenAPI 3.2.0 by upgrading the Microsoft.OpenApi NuGet packages from version 2.0.0 to 3.3.1 and updating the default OpenAPI specification version from 3.1 to 3.2. The PR makes necessary code adaptations to work with the upgraded library's API changes.
Changes:
- Upgrades Microsoft.OpenApi and Microsoft.OpenApi.YamlReader packages from 2.0.0 to 3.3.1
- Changes default OpenAPI specification version from OpenApi3_1 to OpenApi3_2
- Adapts code to API changes in the library (Dictionary<string, OpenApiMediaType> → Dictionary<string, IOpenApiMediaType>)
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| eng/Versions.props | Updates Microsoft.OpenApi package versions from 2.0.0 to 3.3.1 |
| src/OpenApi/src/Services/OpenApiOptions.cs | Changes default OpenAPI version from OpenApi3_1 to OpenApi3_2 |
| src/OpenApi/src/Services/OpenApiGenerator.cs | Adapts to library API change for Content dictionary types |
| src/OpenApi/src/Services/OpenApiDocumentService.cs | Adapts to library API change for Content dictionary types |
| src/OpenApi/gen/XmlCommentGenerator.Emitter.cs | Adds .OfType() filtering when iterating Content values |
| src/Tools/GetDocumentInsider/src/Commands/GetDocumentCommandWorker.cs | Updates default fallback version to OpenApi3_2 |
| src/Tools/GetDocumentInsider/tests/GetDocumentTests.cs | Updates test assertions to expect OpenApi3_2 |
| src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Transformers/CustomSchemaTransformerTests.cs | Adapts test setup to use IOpenApiMediaType dictionary type |
| src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Extensions/OpenApiEndpointRouteBuilderExtensionsTests.cs | Updates version string assertions from "3.1.1" to "3.1.2" |
| src/OpenApi/test/Microsoft.AspNetCore.OpenApi.SourceGenerators.Tests/snapshots/*.cs | Updates generated code to use .OfType() pattern |
| src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Integration/snapshots/OpenApi3_1/*.txt | Updates version string from "3.1.1" to "3.1.2" in snapshots |
| src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Integration/snapshots/OpenApi3_0/OpenApiDocumentIntegrationTests.VerifyOpenApiDocument_documentName=schemas-by-ref.verified.txt | Updates nullable schema structure from library changes |
| src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Integration/snapshots/OpenApiDocumentLocalizationTests.VerifyOpenApiDocumentIsInvariant.verified.txt | Updates version from "3.1.1" to "3.2.0" for default version |
.../Microsoft.AspNetCore.OpenApi.Tests/Extensions/OpenApiEndpointRouteBuilderExtensionsTests.cs
Show resolved
Hide resolved
.../Microsoft.AspNetCore.OpenApi.Tests/Extensions/OpenApiEndpointRouteBuilderExtensionsTests.cs
Show resolved
Hide resolved
For .NET 10 we just had PR builds with prereleases available in MyGet, rather than pushing them to NuGet.org as "official" previews. My aim was to keep the long-lived PR up-to-date as the .NET 11 previews land. |
Possibly. I'm normally against upper bounds, because it could be that in certain scenarios, the breakages are irrelevant to the application, but you prevent the developer from upgrading a dependency without scary suppressions. However, if we know for a fact that it's impossible for any application that uses aspnet.openapi 10 to work with microsoft.openapi >= 3, we can consider it. We wouldn't be able to do that for packages we've already released though. We'd be counting on people updating to the latest 10.x patch before upgrading to 11. |
|
@baywet It looks like some of the Microsoft.AspNetCore.OpenApi.Tests are failing on the CI. Can you look into them? We might just need to regenerate baselines again. |
I thought that the version alignment was sort of a happy coincidence. It would keep Swashbuckle from introducing breaking changes in of-cycle releases if it needs to be continually aligned with ASP.NET Core? |
|
It is a coincidence, yes. |
|
The latest CI run still has a failure in the |
|
@halter73 some auto-formatting got in the way, we should be good now |
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
…or now. Needs to be reverted before GA. Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
55a4d5f to
4999062
Compare
|
@baywet @martincostello What do you both think about getting this into preview 2? That should release in less than a month. Or we could wait until Preview 3 in mid-April. I'm fine either way. I'd lean to getting breaking changes out ASAP, but I don't want to rush you. Edit: I assume getting this out early will be mostly fine given we haven't changed the default spec version. |
|
/backport to release/11.0-preview2 |
|
Started backporting to |
|
To reiterate what I said on teams for others to read: the earlier the better, it gives more time for our partners to coordinate a release on their end and for us to switch the default version with confidence later on |
fixes #63754
a subsequent pull request(s) will be required to take advantage of the new capabilities like item schema for streaming events